package club.justwill.single.persistence.support;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.sql.Timestamp;

/**
 * Created by luoyu on 15-12-24.
 */
@MappedSuperclass
public class AgreementBase extends Jpo {

    @Column(name = "start_time")
    private Timestamp startTime;

    @Column(name = "end_time")
    private Timestamp endTime;

    @Column(name = "user_id")
    private long userId ;

    @Column(name = "project_id")
    private long projectId;

    @Column(name = "costing")
    private Double costing;

    @Column(name = "settle_ment")
    private Double settleMent;

    @Column(name = "service")
    private Double service;

    @Column(name = "sale")
    private Double sale;

    @Column(name = "bonus")
    private Double bonus;

    protected void copyBase(AgreementBase other) {
        setStartTime(other.getStartTime());
        setEndTime(other.getEndTime());
        setUserId(other.getUserId());
        setProjectId(other.getProjectId());
        setCosting(other.getCosting());
        setSettleMent(other.getSettleMent());
        setService(other.getService());
        setSale(other.getSale());
        setBonus(other.getBonus());
    }

    public Double getBonus() {
        return bonus;
    }

    public void setBonus(Double bonus) {
        this.bonus = bonus;
    }

    public Timestamp getStartTime() {
        return startTime;
    }

    public void setStartTime(Timestamp startTime) {
        this.startTime = startTime;
    }

    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        if(userId == null) {
            this.userId = 0;
        } else {
            this.userId = userId;
        }
    }

    public long getProjectId() {
        return projectId;
    }

    public void setProjectId(Long projectId) {
        if(projectId == null) {
            this.projectId = 0;
        } else {
            this.projectId = projectId;
        }
    }

    public Double getCosting() {
        return costing;
    }

    public void setCosting(Double costing) {
        this.costing = costing;
    }

    public Double getSettleMent() {
        return settleMent;
    }

    public void setSettleMent(Double settleMent) {
        this.settleMent = settleMent;
    }

    public Double getService() {
        return service;
    }

    public void setService(Double service) {
        this.service = service;
    }

    public Double getSale() {
        return sale;
    }

    public void setSale(Double sale) {
        this.sale = sale;
    }
}
